import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import {Switch, Tag} from 'ant-design-vue';
import {getLevelSelectsApi, getCategorySelectsApi} from '@/api/sys/common';

import { useMessage } from '@/hooks/web/useMessage';

type CheckedType = boolean | string | number;
export const columns: BasicColumn[] = [
  {
    title: '规则名称',
    dataIndex: 'name',
  },
  {
    title: '积分',
    dataIndex: 'integral',
    width: 180,
  },
  {
    title: '奖惩类型',
    dataIndex: 'type',
    width: 100,
    customRender: ({ record }) => {
      const type = record.type;
      let text="";
      if(type==1){
        text="奖励";
      }
      if(type==2){
        text="处罚";
      }
      if(type==3){
        text="系统回收";
      }
      return text;
    },
  },
  {
    title: '其他说明',
    dataIndex: 'note',
    width: 180,
  },
  {
    title: '时间',
    dataIndex: 'createTime',
    width: 180,
  },

];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '规则名称',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '规则名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'integral',
    label: '积分',
    required: true,
    component: 'Input',
  },
  {
    field: 'type',
    label: '奖惩类型',
    component: 'Select',
    componentProps: {
      options: [
        { label: '奖励', value: 1 },
        { label: '处罚', value: 2 },
        { label: '系统回收', value: 3 },
      ],
    },
  },
  {
    field: 'note',
    label: '备注',
    component: 'Input',
  },
];
